#ifndef MFRAME_H
#define MFRAME_H


#include <wx/frame.h>
#include <wx/bitmap.h>
#include <wx/event.h>
#include <wx/intl.h>
#include <wx/timer.h>

#include "sigamer.h"

//class wxTextCtrl;
class wxStaticText;
class KeyCatcher;
class wxMediaCtrl;
/**
 * The main frame of app
 */
class MainFrame: public wxFrame
{
	public:
		/**
		 * constructor
		 */
		MainFrame();

	private:

        enum Sounds
        {
            SND_RED,
            SND_GREEN,
            SND_BLUE,
            SND_YELLOW,
            SND_ZERO,
            SND_PLUS,
            SND_MINUS
        }; /*         enum Sounds */

        /** 
         * @brief 
         * 
         * @param evt 
         */
		void onSize(wxSizeEvent &evt);

        void onKeyDown(wxKeyEvent &evt);
        void onKeyUp(wxKeyEvent &evt);
        void showState();
        void onTimerAnser(wxTimerEvent &evt);
        void onTimerBlocker(wxTimerEvent &evt);
        /** 
         * @brief Shows how many seconsd left for answer
         */
        void showAnswersTimeLeft();
        /** 
         * @brief Plays given sound
         * 
         * @param iSoundNum 
         */
        void playSound(Sounds iSoundNum);

        wxTimer      tmrAnswers_;    /*!< timer for answers */
        wxTimer      tmr1Answer_;    /*!< timer for answer form one player */
        wxTimer      tmrBlocker_;    /*!< timer for blocking player on 5 s after zero */
        //wxMediaCtrl  *mCtrl;
#ifdef __WXGTK__    //under GTK we should use this hack to recieving messages from keyboard
        KeyCatcher   *keyCatcher_;   /*!< catcher of key events */
#endif        
		wxStaticText *edScore_[4];   /*!< label for scores */
        wxStaticText *stThemeNum_;   /*!< stattext for number of theme */
        wxStaticText *stQuestCost_;  /*!< stattext for cost of current question */
        wxStaticText *stTimer_;      /*!< stattext for timer */
        wxStaticText *stStateInfo_;  /*!< nformer about gamer's state */

        wxString     playerScore_[4];/*!< for setiing score dialog */

        int          ansLeft_;       /*!< answers left seconds */
        int          ans1Left_;      /*!< one answer left seconds */
        /** 
         * @brief count of number of key's pressing. Each player can prss
         * key only once.
         */
        int          countPressing_[4]; 
        bool         isPlayersBlocked;  /*!< flag for blocking player on 5 s after zero */

        SIGamer gamer_;              /*!< machine for states holding */

		DECLARE_EVENT_TABLE()
}; /* class MainFrame: public wxFrame */



#endif	//MFRAME_H
